package com.zlx.xBiaoShop.config;


import com.zlx.xBiaoShop.Interceptor.LoginInterceptor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * @Author 周罗校
 * @Description
 * @ClassName SpringMvcConfig
 * @date 2020.11.03 15:27:17
 * 该版权归周罗校所有，最终解释权以官方为准
 */

@Configuration
public class SpringMvcConfig implements WebMvcConfigurer {
    @Autowired
    private LoginInterceptor loginInterceptor;

    /**
     * 拦截注册
     * @param registry
     */
    @Override
    public void addInterceptors(InterceptorRegistry registry) {
//        LoginInterceptor loginInterceptor = new LoginInterceptor();
        //登陆拦截
        registry.addInterceptor(loginInterceptor)
                .addPathPatterns(new String[]{"/**"})
                .excludePathPatterns(new String[]{"changePwd.html",
                        "/register.html",
                        "user/getUserInfo",
                        "/css/**",
                        "/fonts/**",
                        "/images/**",
                        "/js/**",
                        "/vue/**",
                        "/myjs/**",
                        "/user/**",
                        "/goods/**",
                        "/email/**",
                        "/toQQLogin",
                        "/qq_login",
                        "/WeChat/**",
                        "/kaptcha/**",
                });
    }
}
